<?php
if (!defined('BASEPATH'))
	exit('No direct script access allowed');

$platforms = array('sina', 'tencent', 'sohu', 'netease');

$appkeys = array(
	'sina' => array(
		'904830118'     => array('appkey'=>'904830118','appsec' => '75780b9fb929ede3a1ce470aa42a419d', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'3108540361'    => array('appkey'=>'3108540361','appsec' => '7bd1b8a157c011e6b992b84ea3dffd2b', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'2996608409'    => array('appkey'=>'2996608409','appsec' => 'dc9e69cce6448269b5fb6984c1d906f1', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'1231220476'    => array('appkey'=>'1231220476','appsec' => '8ef8c5e1adbbbba8f26435d42886f408', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'1516049544'    => array('appkey'=>'1516049544','appsec' => 'a5372ae4b3855984b9bd4df04404bc95', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'717272926'     => array('appkey'=>'717272926','appsec' => '9b769bcf47dd85b19bd6a0cb77658dea', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'648929946'     => array('appkey'=>'648929946','appsec' => 'c2bacd05daa3563d25919aa427fc8b29', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'2380499713'    => array('appkey'=>'2380499713','appsec' => '7214bae3f8c1b8bdaaf04b0967f9d4f3', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'4052931831'    => array('appkey'=>'4052931831','appsec' => 'dd54b74ad7f91deee6e1cccc6a297cca', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
		'658435628'     => array('appkey'=>'658435628','appsec' => '8d892a1a2ab7d9ff735a67a06bcfa86b', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),
        '670781897' => array('appkey'=>'670781897','appsec' => '3ba8b3e8498912f4bf1a05279e9efc73', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'),  //高级

		//array('appkey'=>'3977425241','appsec' => 'da874171ec8e8a0f3163ea0818fe4e50', 'callback_url' => 'http://local.unotice.cn/weibo_api/sn_api/callback'), //中级
	),
	'tencent' => array(
        '801354537' => array('appkey' => '801354537','appsec' => '9dd8ed91386c228534e6719bdb64880f'),//高级key,iweibo
		'801436572' => array('appkey' => '801436572','appsec' => 'c5e06ead118aa86358cfc2d1ae228a6f'),//初级key,红麦舆情
	),
    'netease' => array(
        'adFNk5xzpnC4x28t' => array('appkey'=>'adFNk5xzpnC4x28t','appsec' => 'otskhsvAfbQt0NrQyaTf73Syhs4wN2Lm'),
        'UpCcHldbThymD56h' => array('appkey'=>'UpCcHldbThymD56h','appsec' => 'UHRszQRzYIqbcEVize0eTTEF3uQLfmRg'),
        'dJmC76FnjfnX0H82' => array('appkey'=>'dJmC76FnjfnX0H82','appsec' => 'VCeSzYG6Y2vGOj7XqcCbLlrBlj00ZcrW'),
        'gj5V6fAu93Kmt4oG' => array('appkey'=>'gj5V6fAu93Kmt4oG','appsec' => 'Zl7ydRLvTuBbQ9niQLvKD9yNVIq2rg4E'),
        'ho3JPBSZAEIMIgOx' => array('appkey'=>'ho3JPBSZAEIMIgOx','appsec' => 'OTCoq2I1TKEjrizppgK0BnUZv45XORIZ'),
    ),
    'sohu' => array(
        'l0NRANx7X0otBWSUOYXH' => array('appkey'=>'l0NRANx7X0otBWSUOYXH','appsec' => '7HtVXLY*RSLv3Jd5ch*!W4!TbDG$L8Bm0sGEDDYV'),
        'HR6FIsK04nPnodT2c20E' => array('appkey'=>'HR6FIsK04nPnodT2c20E','appsec' => '#VAwBczavijvTcn!lsJ9)QBPu8(Ums9YGneZOlzP'),
        'zsyJbj6sjmHaKfawyoWY' => array('appkey'=>'zsyJbj6sjmHaKfawyoWY','appsec' => 'bCvrsrAmyxAcWEVD$4H7Sh%7rQOOM0^ckmbS=rrE'),
        'KaPXEsCqA0AbLQVVVoRE' => array('appkey'=>'KaPXEsCqA0AbLQVVVoRE','appsec' => '!AO4NQQqyU9TQT)6lRY%c^-VMbNN)$5KJBXJwIVH'),
        'CBFJbtECsiY9PC2rkS89' => array('appkey'=>'CBFJbtECsiY9PC2rkS89','appsec' => 'b(SyXlYuC3V)=Wz*-M4Vp7vmn1wX2e!(#ma)I*^Z'),
    )
);

$htmlsearch = array(
    'sina_html' => array(
        'source_myid'       => '3-1-1',   //标识微博不同的数据源
        'url'               => 'http://s.weibo.com/weibo/',
        'result_success'    => '</html>',
        'result_error'      => '\u8bf7\u8f93\u5165\u9a8c\u8bc1\u7801',//请输入验证码json_encode
        'null'              => '/\\\u62b1\\\u6b49\\\uff0c\\\u672a\\\u627e\\\u5230\\\u201c(.*)\\\u201d\\\u76f8\\\u5173\\\u7ed3\\\u679c/iU',//抱歉，未找到“(.*)”相关结果
                                //根据相关法律法规和政策，“(.*)”搜索结果未予显示
        'illegal_tag'       => '/\\\u6839\\\u636e\\\u76f8\\\u5173\\\u6cd5\\\u5f8b\\\u6cd5\\\u89c4\\\u548c\\\u653f\\\u7b56\\\uff0c\\\u201c(.*)\\\u201d\\\u641c\\\u7d22\\\u7ed3\\\u679c\\\u672a\\\u4e88\\\u663e\\\u793a/iU',
        'rules'             => '',
        //'xsort'             => array('3-1-1-1' => NULL , '3-1-1-2' => 'time', '3-1-1-3' => 'hot'),//默认第一页使用xsort参数抓取全部选项卡
        'xsort'             => array('3-1-1-2' => 'time'),//提升效率 只抓取最新选项卡
        'mini_xsort'        => array('3-1-1-2' => 'time'),//第一页以后只抓取实时选项卡
        'header'            => array(
                                "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                                "Accept-Charset:GBK,utf-8;q=0.7,*;q=0.3",
                                "Accept-Encoding:gzip,deflate,sdch",
                                "Accept-Language:zh-CN,zh;q=0.8",
                                "Cache-Control:no-cache",
                                "Connection:keep-alive",
                                "Content-Type:text/html; charset=utf-8"
        ),
        'user_agent'        => "User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22",
        //'referer'			=> "http://s.weibo.com/",
        //'time_out'			=> 20
    ),

	'sina_wap' => array(
		'source_myid'       => '3-1-2',   //标识微博不同的数据源
		'url'               => 'http://weibo.cn/search/mblog',
		'result_success'    => '</html>',
        'tab_preg'          => '/\<div class=\"c\" id=\"(.+)\"\>/iU',
        'no_login'          => '忘记密码',
		'result_error'      => '请输入验证码',
        'null'              => '/抱歉，未找到“(.*)”相关结果/iU',
		'rules'             => '',
        'header'            => array(
                                "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                                "Accept-Encoding: gzip,deflate,sdch",
                                "Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
                                "Connection: keep-alive",
        ),//注意.此处的header好像有问题...引用此配置后.返回的内容为乱码..
        'user_agent'        => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
	),

    'sina_phone' => array(
        'source_myid'       => '3-1-8',   //标识微博不同的数据源
        'url'               => 'http://m.weibo.cn/page/pageJson',
        //'result_success'    => 'maxPage',
    	'result_success'    => 'total',
        'tab_preg'          => '/\<div class=\"c\" id=\"(.+)\"\>/iU',
        'no_login'          => '忘记密码',
        'result_error'      => '请输入验证码',
        'null'              => '/抱歉，未找到“(.*)”相关结果/iU',
        'rules'             => '',
        'header'            => array(
            "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
            "Accept-Encoding: gzip,deflate,sdch",
            "Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3",
            "Connection: keep-alive",
        ),//注意.此处的header好像有问题...引用此配置后.返回的内容为乱码..
        'user_agent'        => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"
    ),
    'yunyun_html' => array(
        'source_myid'       => '5-1',
        'url'               => 'http://weibo.yunyun.com/Weibo.php',   //web
        'result_success'    => '</html>',
        'tab_preg'          => '/searchHotMBlogKeywordTabs/iU',
        'no_login'          => '忘记密码',
        'result_error'      => '输入验证码',
        'null'              => '/抱歉，没有找到与“(.*)”相关的微博结果/iU',
        'rules'             => ''
    ),
    'yunyun_wap' => array(
        'source_myid'       => '5-2',
        'url'               => 'http://weibom.yunyun.com/Weibo.php',   //wap
        'result_success'    => '</html>',
        'tab_preg'          => '/class="s_shi">/iU',
        'no_login'          => '忘记密码',
        'result_error'      => '输入验证码',
        'null'              => '/抱歉，没有找到与“(.*)”相关的微博结果/iU',
        'rules'             => ''
    ),
	'tencent' => array(
		'source_myid'       => '3-2',   //标识微博不同的数据源
		'url'               => 'http://search.t.qq.com/index.php',
		'result_success'    => '</html>',
		'result_error'      => '请输入验证码',
        'no_login'          => 'loginBox',
        'restricted_tag'    => '搜太多啦，服务器累得回火星了，休息一下吧',
        'illegal_tag'       => '根据相关法律法规和政策，搜索结果未予显示。',
        'null'              => '/抱歉，暂时没有找到与“(.*)”相关的广播/iU',
        'tab_preg'          => '/li\s+id="[0-9]+" rel="[0-9]+"/iU',
        'pos'               => 211,
        's_dup'             => 1,
		'rules'             => ''
	),
	'tencent_client' => array(
		'source_myid'       => '6-2',   //标识微博不同的数据源
		'url'               => 'http://ti.3g.qq.com/touch/s',
	),
	'sohu' => array(
		'source_myid'       => '3-3',   //标识微博不同的数据源
		'url'               => 'http://t.sohu.com/twsearch/twSearch?key=keyword&pageNo=pagenum',
		'result_success'    => '_con" class="twi',
		'result_error'      => '请输入验证码',
		'rules'             => ''
	),
	'netease' => array(
		'source_myid'       => '3-4',   //标识微博不同的数据源
		'url'               => 'http://t.163.com/search.do?action=searchTweet',
		'result_success'    => 'relatedTweet"',
		'result_error'      => '请输入验证码',
		'rules'             => '',
        'null'              => ''
	)
);

$apisearch = array(
	'sina' => array(
		'source_myid' => '4-1'  //标识微博不同的数据源
	),
	'tencent' => array(
		'source_myid'   => '4-2',  //标识微博不同的数据源
        'appfrom'       => 'php-sdk2.0beta',
        'oauth_version' => '2.a',
        'url'           => 'https://open.t.qq.com/api/', //API 地址
        'search'        => 'search/t',
	),
	'sohu' => array(
		'source_myid' => '4-3',   //标识微博不同的数据源
        'url'         => 'https://api.t.sohu.com/',
        'search'      => 'statuses/search.json',
        'rpp'         => 20,
	),
	'netease' => array(
		'source_myid' => '4-4',  //标识微博不同的数据源
	)
);

$config['openplatforms']['platforms'] = $platforms;
$config['openplatforms']['app_info'] = $appkeys;
$config['openplatforms']['htmlsearch'] = $htmlsearch;
$config['openplatforms']['apisearch'] = $apisearch;

//抓取关键词级别 级别 => 取词频率,级别数字越大..权重越低.时间间隔也就越大
$config['word_level']['words_level_update'] = array(
	1 => 10*60,
	2 => 15*60,
	3 => 22*60,
	4 => 30*60,
	5 => 45*60,
	6 => 60*60,
	7 => 2*60*60,
	8 => 3*60*60,
	9 => 4*60*60
);

// 通过新浪手机链接获取微博信息相关变量
$config['sina_phone_val'] = array(
    // 评论链接模板 uid: 博主id， mid 微博的数字id
    'comm_url_temp' => 'http://m.weibo.cn/{uid}/{mid}/rcMod?format=cards&type=comment&hot=1',
    // 评论列表模板
    'single_comm_url_temp' => 'http://m.weibo.cn/single/rcList?format=cards&id={mid}&hot=0&page={page}',
    // 返回js的正则
    'js_patt' => '|window\.\$render_data = (.*?);</script>|i',
);

/**
* End of file openplatforms.php
*/
/**
* Location: ./application/config/openplatforms.php
*/
